<?php
class Vs_Category_Mapper
    extends Vs_Mapper
	
{
	public function delete( $category )
	{
		$mapper = Vs_Factory::mapper('Question');
	 	$questions = $mapper->getByParams( array('categoryId' => $category->getId()));
		
		if ( count($questions) ){
			throw new Vs_Exception( Vs_Exception::CATEGORY_CANNOT_BE_DELETED );
		}
				
		$table= $this->getTable();
		
		return $table->delete( $category );
	}
}
